﻿@using XiaoYuStock.Model
@using XiaoYuStock.Model.Models
@using XiaoYuStock.Model.Request
@using XiaoYuStock.WebApp.Controls
@model MyTradData
@{
    Layout = "~/Views/Shared/_Layout.Edit.cshtml";
}
@section PageSpecificStyleSheetIncludes{
}
@section PageSpecificJavascriptIncludes{
}
@section MainContent{
    <div class="portlet-body form-horizontal form-bordered form-row-stripped">
        <div class="row-fluid">
            <div class="control-group">
                <label class="control-label">时间：</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.TradeTime, new { @class = "m-wrap small" })
                </div>
            </div>
            <div class="control-group">
                <label class="control-label"><span class="required">*</span>代码/名称：</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.ShareCode, new { @class = "m-wrap" })
                    <span id="spShareCode"></span><span id="spShareName"></span>
                    <span class="help-inline"><a id="btnRefresh" style="cursor:pointer;">刷新</a></span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">账号类型：</label>
                <div class="controls">
                    <select id="ShareAccount" name="ShareAccount">
                        <option value="A">A</option>
                        <option value="B">B</option>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">交易类型：</label>
                <div class="controls">
                    @Html.DropDownList("TradedState")
               
                </div>
            </div>
          

            <div class="control-group">
                <label class="control-label">价格：</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.TradeAmount, new { @class = "m-wrap" })
                    
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">数量：</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.TradeCount, new { @class = "m-wrap" })

                </div>
            </div>
        </div>
    </div>
}
<script>   
    var dates = $("#TradeTime").datepicker({
        dateFormat: "yy-mm-dd",
        defaultDate: "+0",
        changeMonth: true,
        changeYear: true,
        numberOfMonths: 1,
        onSelect: function (selectedDate) {
            var option = this.id == "startDate" ? "minDate" : "maxDate",
            instance = $(this).data("datepicker"),
            date = $.datepicker.parseDate(
                instance.settings.dateFormat ||
                $.datepicker._defaults.dateFormat,
                selectedDate, instance.settings);
            dates.not(this).datepicker("option", option, date);
        }
    });
    $(function () {
        var account = '@Model.ShareAccount';
        if (account.length > 0)
        {
            $("#ShareAccount").val(account);
        }
        $("#btnRefresh").click(function () {
            $("#spShareCode").text('');
            $("#spShareName").text('');

            $.post("/ShareList/GetCurrentShares", { code: $("#ShareCode").val() }, function (data) {
                if (data.status) {
                    $("#spShareCode").text(data.shareCode);
                    $("#spShareName").text(data.shareName);
                }
            });
        });

    })

</script>



